function [A]=orth_function_curvefitting(X,Y,K,W)
% X=[0:0.25:1]';K=2; %e.g.3.8 on page 71
% Y=[0.1 0.35 0.81 1.09 1.96].';

% Get Polynomial Coefficients of the base
A_nature = orth_base_func(X,K);
A_coordinate=zeros(K+1,1);
for iiK=0:K
    %Get Base Function Value on Given Point Set
    A_base(:,iiK+1) = orth_base_func2(A_nature(:,iiK+1),X);
    A_coordinate(iiK+1) = (Y'*A_base(:,iiK+1))/(A_base(:,iiK+1)'*A_base(:,iiK+1));
end
% Get Polynomial Coefficients of Curve Fitting Fuction
A=A_nature*A_coordinate;